﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;


namespace Infrastructure.Aspect.Test
{
    

    [TestClass]
    public class SerializationServiceTest
    {
        public static IUnityContainer Container;

        [ClassInitialize()]
        public static void Initialize(TestContext testContext)
        {

            Container = UnityHelper.BuildUnityContainer();
        }
        [TestMethod]
        public void SerializationTest()
        {
            var ent = new Entities.Master();
            ent.Title = "test";
            ent.Details = new List<Entities.Detail>();
            ent.Details.Add(new Entities.Detail() { Title = "test", CurrentMaster=ent });            

            

            var ser = Container.Resolve<Infrastructure.Aspect.Services.Serialization.ISerializationService>();
            var res = ser.Serialization(ent);
            var target = ser.DesSerialization<Entities.Master>(res);

            Assert.AreEqual<string>(ent.Title, target.Title);

        }
    }
}
